<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加账户</title>
    <script src="js/axios-0.18.0.js"></script>
    <script src="js/vuejs-2.5.16.js"></script>

</head>
<body>
    <div id="app">
        <form onsubmit="return false">
            账户:<input type="text" name="name" v-model="account.name"/><br/>
            金额:<input type="text" name="money" v-model="account.money"/><br/>
            <input type="submit" value="添加" @click="addAccount()"/><br/>
        </form>
    </div>
</body>
<script type="text/javascript">
    new Vue({
       el:"#app",
       data:{
           account:{}
       },
        methods:{
            addAccount(){
                let params=this.account;
                axios.post("/account/addAccount",params).then(response=>{
                    alert(222)
                    if(response.data.flag){
                        location.href="/accountList.html"
                    }
                }).catch(error=>{
                    console.log(error);
                })
            }
        }
    });
</script>
</html>